<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <title>分类</title>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <link rel="stylesheet" href="../../css/aui.css">
    <style>
        html,
        body {
            background-color: #fff;
        }

        .datalist {
            width: 100%;
            padding-left: 10px;
            padding-right: 15px;
            box-sizing: border-box;
            overflow: hidden;
        }

        .banner {
            width: 100%;
            margin-top: 10px;
        }

        .banner_inner {
            width: 100%;
            height:80px;
        }
        .banner_inner>.swiper-container>.swiper-wrapper>.swiper-slide{
          width: 100%;
          height: 80px;
          border-radius: 5px;
        }
        .banner_inner>.swiper-container>.swiper-wrapper>.swiper-slide>img{
          display: block;
          width: 100%;
          height:100%;
          border-radius: 5px;
        }
        .datalist ul {
            width: 100%;
            overflow: hidden;
        }

        .datalist ul li {
            width: 33%;
            float: left;
            margin-top: 10px;
            overflow: hidden;
        }

        .datalist ul li:nth-child(3n+1) {
            margin-left: 0;
        }

        .datalist ul li div.picture {
            width: 48px;
            height: 48px;
            margin: 0 auto;
            /*border: 1px solid red;*/
        }

        .datalist ul li div.picture img {
            width: 100%;
            height: 100%;
            display: block;
        }

        .datalist ul li div.name {
            font-size: 14px;
            font-family: PingFang SC;
            font-weight: 400;
            color: #333333;
            margin-top: 10px;
            text-align: center;
        }

        .datalist ul li div.discribe {
            font-size: 14px;
            font-family: PingFang SC;
            font-weight: 400;
            color: #FF3537;
            margin-top: 5px;
            text-align: center;
        }

        [v-cloak] {
            display: none!important;
        }
    </style>
</head>

<body>
    <div id="app">
        <div class="datalist">
          <div class="banner" @click='openGoodsDetailsPage()'>
              <div class="banner_inner">
                <div class="swiper-container swiper4" >
                    <div class="swiper-wrapper">
                        <div class="swiper-slide" @click='SwiperJumpLink(item.urlType,item.url)'><img src="../../image/buycard_banner.png" alt=""></div>
                    </div>
                </div>
              </div>
          </div>
            <ul>
                <li v-for='item in dataList'  @click='SwiperJumpLink(item.htype,item.hurl)'>
                    <div class="picture"><img :src="item.cpic" alt=""></div>
                    <div class="name">{{item.cname}}</div>
                    <div class="discribe">{{item.discribe}}</div>
                </li>

            </ul>
        </div>

    </div>
</body>
<script type="text/javascript" src="../../script/api.js"></script>
<script type="text/javascript" src="../../script/vue.js"></script>
<script type="text/javascript" src="../../script/cling.js"></script>
<script type="text/javascript">
    apiready = function() {
        api.addEventListener({
            name: 'getbuycard'
        }, function(ret, err){
            if( ret ){
                //  alert( JSON.stringify( ret ) );
                 vm.getIndexCateGory(ret.value.id)
            }else{
                 alert( JSON.stringify( err ) );
            }
        });
        vm.getIndexCateGory(api.pageParam.id)

    }
    var vm = new Vue({
        el: '#app',
        data: {
          dataList:[]
        },
        methods: {
          getIndexCateGory: function(id) {
              api.ajax({
                  url: cl.apiServer + 'buyBuyCard/getList',
                  method: 'post',
                  headers: {
                      'Content-Type': 'application/json;charset=utf-8',
                      token:cl.userToken
                  },
                  data: {
                      body: {
                          parentId:id,
                          version:cl.deviceInfo().appVersion,
                          mobileInfo:cl.systemType()
                      }
                  }
              }, function(ret, err) {
                  // alert(JSON.stringify(ret));
                  if (ret) {
                      if (ret.code == 0) {
                      vm.dataList = ret.data;

                      }
                  }
              });
          },
          /**
           *
           * 轮播图跳转
           * @return {[type]} [description]
           */

          SwiperJumpLink: function(urlType, url) {
              if (urlType == 0) {
                  cl.openWin({
                      name: '../../brower',
                      pageParam: {
                          link: url
                      }
                  })
              }
          },
        }
    })
</script>

</html>
